#include<bits/stdc++.h>
#define int long long
using namespace std;

const int N = 2e5 + 10;
int a[N], b[N], ans[N], stk[N], top, l[N], r[N];
int n;
void solve1() {
	int Min = 1e18;
	for(int i = 1; i <= n; i++) Min = min(Min, a[i]);
	for(int i = 1; i <= n; i++) cout << Min - 1 << '\n';
}
void solve2() {
	for(int i = 1; i <= n; i++) {
		while(top && a[stk[top]] >= a[i]) --top;
		l[i] = stk[top];
		stk[++top] = i;
	}
	top = 0;
	for(int i = n; i >= 1; i--) {
		while(top && a[stk[top]] >= a[i]) --top;
		r[i] = stk[top];
		if(!top) r[i] = n + 1;
		stk[++top] = i;
	} 
	memset(ans, 0x7f, sizeof(ans));
	for(int i = 1; i <= n; i++)
		ans[r[i] - l[i] - 1] = min(ans[r[i] - l[i] - 1], b[1] - a[i]);
	for(int i = n; i >= 1; i--) ans[i] = min(ans[i], ans[i + 1]);
	for(int i = 1; i <= n; i++) cout << ans[i] << '\n'; 
}
signed main() {
	freopen("min.in", "r", stdin);
	freopen("min.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= n; i++) cin >> b[i];
	if(n > 1000) {
		if(b[1] == 1) solve1();
		else solve2();
		return 0;
	} 
	memset(ans, 0x7f, sizeof(ans));
	for(int i = 1; i <= n; i++) {
		int Mina = a[i], Minb = b[i];
		ans[1] = min(ans[1], abs(Mina - Minb));
		for(int j = i + 1; j <= n; j++) {
			Mina = min(Mina, a[j]);
			Minb = min(Minb, b[j]);
			ans[j - i + 1] = min(ans[j - i + 1], abs(Mina - Minb));
		}
	}
	for(int i = 1; i <= n; i++) cout << ans[i] << '\n';
	return 0;
}

